package com.otoe.dilidilivid.utils;

import android.graphics.Bitmap;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class SaveBitmap {
    public static String getJpgPath(Bitmap mBitmap, String bitName)  {

        File f = new File( "/storage/emulated/0/Pictures/"+bitName + ".jpg");

        FileOutputStream fOut = null;

        try {

            fOut = new FileOutputStream(f);

        } catch (FileNotFoundException e) {

            e.printStackTrace();

        }

        mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut);

        try {

            fOut.flush();

        } catch (IOException e) {

            e.printStackTrace();

        }

        try {

            fOut.close();

        } catch (IOException e) {

            e.printStackTrace();

        }

        return f.toString();
    }
}
